<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      layout:decorate="${username}=='zzz'?layout1:layout">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>省份</title>
    <script src="js/provincelist/provincelist.js"></script>
</head>

<body>
<div  layout:fragment="content">
    <div class="container-fluid">
        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
            <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pb-2 mb-3 border-bottom">
                <h1 class="h2">省份管理</h1>
            </div>
            <div class="row" style="margin-bottom: 15px">
                <span>&nbsp;&nbsp;&nbsp;</span>
                <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addPro">添加省份</button>
            </div>

            <div>
                <table class="table table-striped">
                    <thead>
                    <tr>
                        <th scope="col">#</th>
                        <th scope="col">省份</th>
                        <th scope="col">标签</th>
                        <th scope="col">景点数</th>
                        <th scope="col">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each=" pro:${provinceList}">
                        <th scope="row"></th>
                        <td th:text="${pro.name}"></td>
                        <td th:text="${pro.tags}"></td>
                        <td th:text="${pro.placecounts}"></td>
                        <td>
                            <a href="#" class="btn btn-danger btn-sm active" role="button" aria-pressed="true" th:onclick="deletePro([[${pro.id}]])">删除</a>
                            <a href="#" class="btn btn-success btn-sm active" role="button" aria-pressed="true" th:onclick="editPro([[${pro}]])">编辑</a>
                            <a href="#" th:href="@{/place1}" class="btn btn-primary btn-sm active" role="button" aria-pressed="true"  th:onclick="selectPro([[${pro.id}]])">查看当地景点</a>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </main>
    </div>

    <!--省份添加模态窗口-->
    <div class="modal fade" id="addPro" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLabel"><span style="color: #0c5460;font-weight: bold">添加省份</span></h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form name="form1" class="form-horizontal">
                        <input type="hidden" class="form-control col-sm-8"  id="proId" >
                        <div class="form-group row">
                            <label class="col-form-label col-sm-2">省份:</label>
                            <input type="text" class="form-control col-sm-8" id="proName" >
                        </div>
                        <div class="form-group row">
                            <label class="col-form-label col-sm-2">标签:</label>
                            <input type="text" class="form-control col-sm-8" id="proTags">
                        </div>
                        <div class="form-group row">
                            <label class="col-form-label col-sm-2">景点数:</label>
                            <input type="text" class="form-control col-sm-8" id="placeCounts">
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary" onclick="save()">提交</button>
                </div>
            </div>
        </div>
    </div>


    <!--省份更新模态窗口-->
    <div class="modal fade" id="updatePro" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLabel1"><span style="color: #1e7e34;font-weight: bold">编辑省份</span> </h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">
                        <input type="hidden" class="form-control col-sm-8"  id="proId1" >
                        <div class="form-group row">
                            <label class="col-form-label col-sm-2">省份:</label>
                            <input type="text" class="form-control col-sm-8" id="proName1">
                        </div>
                        <div class="form-group row">
                            <label class="col-form-label col-sm-2">标签:</label>
                            <input type="text" class="form-control col-sm-8" id="proTags1">
                        </div>
                        <div class="form-group row">
                            <label class="col-form-label col-sm-2">景点数:</label>
                            <input type="text" class="form-control col-sm-8" id="placeCounts1">
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary" onclick="save1()">提交</button>
                </div>
            </div>
        </div>
    </div>



</div>
</body>

</html>